import instance from '@/http/index.js'
import type {loginLogForm,operationLogForm} from './type.ts'
//统一管理接口
enum API {
    loginLog_url = '/llog/loginLog',
    operationLog_url = '/olog/operationLog',
    loginLogList_url = '/llog/loginLogList',
    operationLogList_url = '/olog/operationLogList',
    searchLoginLogList_url = '/olog/searchOperationLogList',
	searchOperationLogList_url = '/olog/searchOperationLogList',
    loginLogListLength_url = '/llog/loginLogListLength',
    operationLogListLength_url = '/olog/operationLogListLength',
    returnLoginListData_url = '/llog/returnLoginListData',
    returnOperationListData_url = '/olog/returnOperationListData',
    clearLoginLogList_url = '/llog/clearLoginLogList',
    clearOperationLogList_url = '/olog/clearOperationLogList'
}
// 登录记录
export const loginLog = (data:loginLogForm) => {
    return instance.post(API.loginLog_url,data)
}

// 操作记录
export const operationLog = (data:operationLogForm) => {
	return instance.post(API.operationLog_url,data)
}

// 返回登录日志列表
export const loginLogList = () => {
	return instance.post(API.loginLogList_url)
}

// 返回操作日志列表
export const operationLogList = () => {
	return instance.post(API.operationLogList_url)
}

// 返回最近十条登录日志
export const searchLoginLogList = (account:string| number) => {
	return instance.post(API.searchLoginLogList_url,{account})
}

// 返回最近十条操作日志
export const searchOperationLogList = (operation_person:string) => {
	return instance.post(API.searchOperationLogList_url,{operation_person})
}


// 返回登录日志列表的长度
export const loginLogListLength = () => {
	return instance.post(API.loginLogListLength_url)
}

// 返回操作日志列表的长度
export const operationLogListLength = () => {
	return instance.post(API.operationLogListLength_url)
}

// 监听换页返回数据
export const returnLoginListData = (pager:number) => {
	return instance.post(API.returnLoginListData_url,{pager})
}

export const returnOperationListData = (pager:number) => {
	return instance.post(API.returnOperationListData_url,{pager})
}

// 清空登录日志
export const clearLoginLogList = () => {
	return instance.post(API.clearLoginLogList_url)
}

// 清空操作日志
export const clearOperationLogList = () => {
	return instance.post(API.clearOperationLogList_url)
}